# coding=utf-8
with open('建行部门过滤.json', 'r', encoding = 'UTF-8') as f1:
    global dt
    dt = eval(f1.read())

with open('deleteOrgSql.txt', 'w', encoding = 'UTF-8') as f1:
    for d in dt.values():
        for l in d:
            f1.write(f'''---部门:{l['orgName']} 删除\n''')
            f1.write(f'''delete from pub_organ where code ='{l['orgCode']}' \n''')
            f1.write(f'''delete from pub_organ_map where org_code ='{l['orgCode']}' \n''')
            f1.write(f'''delete from pub_organ_of_view where org_code ='{l['orgCode']}' \n''')
            f1.write(f'''delete from pub_organ_tree where org_code ='{l['orgCode']}' \n''')
            f1.write(''' \n'''*3)
# delete   from   pub_organ
# where code ='1152000000909013XD';
#
#
#
#
# delete  from   pub_organ_map
# where org_code='1152000000909013XD';
#
# delete   from    pub_organ_of_view
# where org_code ='1152000000909013XD';
#
#
# delete   from  pub_organ_tree
# where org_code='1152000000909013XD';
